function formatItemParamData(value, index) {
	var json = JSON.parse(value);
	var array = [];
	$.each(json, function (i, e) {
		array.push(e.group);
	});
	return array.join(",");
}

function getSelectionsIds() {
	var itemList = $("#itemParamList");
	var sels = itemList.datagrid("getSelections");
	var ids = [];
	for ( var i in sels) {
		ids.push(sels[i].id);
	}
	ids = ids.join(",");
	return ids;
}

var itemParamListToolbar = [{
	text: '新增',
	iconCls: 'icon-add',
	handler: function () {
		MAINFUNTION.createWindow({
			url: "/rest/page/item-param-add",
		});
	}
}, {
	text: '编辑',
	iconCls: 'icon-edit',
	handler: function () {
		$.messager.alert('提示', '该功能未实现!');
	}
}, {
	text: '删除',
	iconCls: 'icon-cancel',
	handler: function () {
		var ids = getSelectionsIds();
		if (ids.length == 0) {
			$.messager.alert('提示', '未选中商品规格!');
			return;
		}
		$.messager.confirm('确认', '确定删除ID为 ' + ids + ' 的商品规格吗？', function (r) {
			if (r) {
				var params = {
					"ids": ids
				};
				$.ajax({
					type: "POST",
					url: "/rest/item/param/delete",
					async: true,
					data: params,
					statusCode: {
						404: function () {
						},
						200: function (data) {
							$.messager.alert('提示', '删除商品规格成功!', undefined, function () {
								$("#itemParamList").datagrid("reload");
							});
						},
						500: function () {
						}
					}
				});
			}
		});
	}
}];